﻿using System;
using BackupAssurance;
using System.Collections.Generic;
using System.Threading;
using BackupAssurance.Library.ModelsDB;


namespace BackupAssurance
{
    public class Program1
    {
        QuickRun objRun;

        public Program1()
        {

        }

        static void Main(string[] args)
        {
            Program1 p = new Program1();
            p.run();


        }
        public void run()
        {
            string output;
            objRun = new QuickRun();
            objRun.OnStart();

            do
            {
                Console.WriteLine("");

                output = String.Format("Job Listings as of {0}  with next fire time:{1}", DateTime.Now, objRun._objTimer.TimerFireDateTime);
                Console.WriteLine(output);

                foreach (var item in objRun._objTimer.getScheduledJobs())
                {
                    output = String.Format("{0}, [{1}], {2}, {3}, {4}, {5}", item._JobAction.Id, item._JobAction.name, item._NextRunDateTime, item._Base, item._LastRunTime, item._Offset);
                    Console.WriteLine(output);
                }

                Thread.Sleep(10000);

            } while (true);

        }


        public void OnStart()
        {
            objRun = new QuickRun();
            objRun.OnStart();
        }

        public void OnStop()
        {
            objRun.OnStop();
            objRun = null;
        }

    }
}
